<div class="products">
    <div class="products-title">
        <h3>Giỏ hàng</h3>
    </div>
    <div class="cart">
        <?php
        $cart = $_SESSION['cart'];
//        print "<pre>";
//        print_r($cart);
//        print "</pre>";
        if ($this->cartPro) {
            ?>
            <form name="" id="frmCart" action="<?php echo URL_BASE; ?>/cart/order" method="post">

                <table border="1">
                    <tr align="center">
                        <th>Sản phẩm</th>
                        <th>Số lượng</th>
                        <th>Thành tiền</th>
                        <th>Thao tác</th>
                    </tr>
                    <?php
                    $sum = 0;
                    $pro = new Default_Models_Product();
                    foreach ($this->cartPro as $pro) {
                        ?>
                        <tr>                                    
                            <td align="center" bgcolor="#FFFFFF">                                              
                                <div style="float: left;"><a href="<?php echo URL_BASE; ?>/product/detail/<?php echo $pro->getProId(); ?>"><img src="<?php echo $pro->getThumb(); ?>" border="0" height="50"></a></div>
                                <div><a href="<?php echo URL_BASE; ?>/product/detail/<?php echo $pro->getProId(); ?>" style="color:#006699; font-weight:normal;"><?php echo $pro->getName(); ?></a><br />                                       
                                    <span style="color:#FF0000; font-size:12px; font-weight:bold;"><?php echo number_format($pro->getPrice(), 0, ',', '.') . " VNĐ"; ?></span></div>
                                <!--<input type="hidden" name="txtProId[]" value="<?php echo $pro->getProId(); ?>" />-->
                            </td>

                            <td align="center" bgcolor="#FFFFFF" valign="middle">
                                <!--<form name="" action="<?php echo URL_BASE; ?>/cart/updateCart" method="post">-->
                                <input type="text" name="txtQuantity[<?php echo $pro->getProId(); ?>]" value="<?php echo $cart[$pro->getProId()]; ?>" style="width:30px; text-align: right; padding: 3px 5px;" />
                                <!--</form>-->
                            </td>

                            <td style="font-weight:bold; text-align:center;"  bgcolor="#FFFFFF">
                                <span style="color:#FF0000;font-size:14px;"><?php echo number_format(($cart[$pro->getProId()] * $pro->getPrice()), 0, ',', '.') . " VNĐ"; ?></span>
                            </td>

                            <td align="center" bgcolor="#FFFFFF" valign="middle" width="105">
                                <a href="<?php echo URL_BASE . '/cart/delCart/' . $pro->getProId(); ?>"><input type="button" value="Xóa"></a>
                            </td>
                        </tr>
                        <?php
                        $sum += $cart[$pro->getProId()] * $pro->getPrice();
                    }
                    ?>
                    <tr>
                        <td colspan="4" style="font-weight:bold; text-transform:uppercase; color:#000000;" align="right" bgcolor="#FFFFFF">Tổng cộng: <span id="total" style="font-weight:bold; color:#FF0000"><?php echo number_format($sum, 0, ',', '.') . " VNĐ"; ?></span></td>                       
                    </tr>
                    <tr>
                        <td colspan="4" align="right"><a href="<?php echo URL_BASE; ?>"><input value="Tiếp tục mua hàng" onclick="" type="button"></a>
                            <a href="#">
                                <?php if (isset($_SESSION['user'])): ?>
                                    <input value="Đặt hàng" type="submit" id="btnOrder">
                                <?php else: ?>
                                    <input value="Đặt hàng" type="submit" id="btnPreOrder">
                                <?php endif ?>
                            </a>
                            <a href="#"><input type="submit" value="Cập nhật" id="btnUpdate" /></a>
                            <a href="<?php echo URL_BASE . '/cart/delCart' ?>"><input type="button" value="Xóa giỏ hàng"></a>
                        </td>
                    </tr>
                </table>

            </form>

            <?php
        } else {
            echo "Không có sản phẩm nào trong giỏ hàng";
        }
        ?>
    </div>

    <!--Login box-->
    <div class="login-box">
        <form name="logForm" action="<?php echo URL_BASE; ?>/customer/loginProcess" onsubmit="return validateLogForm();" method="post">
            <p style="color: #FF0000;">Bạn cần đăng nhập để đặt hàng<br />Nếu chưa có tài khoản đăng ký <a href="<?php echo URL_BASE; ?>/customer/register" style="color: #000; text-decoration: underline; margin: 0;">tại đây</a></p>
            <p>
                <label>Địa chỉ Email:</label><br />
                <input type="text" name="txtUser" id="username" value="<?php echo $_COOKIE['user']; ?>" />
            <div class="mess" id="un-mess" style="margin: 0;"></div>
            </p>
            <p>
                <label>Mật khẩu:</label><br />
                <input type="password" name="txtPass" id="password" value="<?php echo $_COOKIE['pass']; ?>" />
            <div class="mess" id="pw-mess" style="margin: 0;"></div>
            </p>
            <p>
                <label></label>
                <input type="checkbox" name="chkRemember" value="1" checked /> Nhớ mật khẩu
            </p>
            <p>
                <label></label>
                <input type="submit" name="btnSubmit" value="Đăng nhập" />
            </p>
            <div style="float:right;"><a href="javascript: void(0);" class="close" >ĐÓNG</a></div>
        </form>
    </div>
</div>